<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>shaker</title>
    <link rel="stylesheet" type="text/css" href="csound.css" />
    <meta name="generator" content="DocBook XSL Stylesheets V1.78.1" />
    <link rel="home" href="index.html" title="The Canonical Csound Reference Manual" />
    <link rel="up" href="OpcodesTop.html" title="Orchestra Opcodes and Operators" />
    <link rel="prev" href="sfpreset.html" title="sfpreset" />
    <link rel="next" href="shiftin.html" title="shiftin" />
  </head>
  <body>
    <div class="navheader">
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">shaker</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="sfpreset.html">Prev</a> </td>
          <th width="60%" align="center">Orchestra Opcodes and Operators</th>
          <td width="20%" align="right"> <a accesskey="n" href="shiftin.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="refentry">
      <a id="shaker"></a>
      <div class="titlepage"></div>
      <a id="IndexShaker" class="indexterm"></a>
      <div class="refnamediv">
        <h2>
          <span class="refentrytitle">shaker</span>
        </h2>
        <p>shaker — 
      Sounds like the shaking of a maraca or similar gourd instrument.
    </p>
      </div>
      <div class="refsect1">
        <a id="idp147156576"></a>
        <h2>Description</h2>
        <p>
      Audio output is a tone related to the shaking of a maraca or similar gourd instrument. The method is a physically inspired model developed from Perry Cook, but re-coded for Csound.
    </p>
      </div>
      <div class="refsect1">
        <a id="idp147157968"></a>
        <h2>Syntax</h2>
        <pre class="synopsis">ares <span class="command"><strong>shaker</strong></span> kamp, kfreq, kbeans, kdamp, ktimes [, idecay]</pre>
      </div>
      <div class="refsect1">
        <a id="idp147160144"></a>
        <h2>Initialization</h2>
        <p>
      <span class="emphasis"><em>idecay</em></span> -- If present indicates for how long at the end of the note the shaker is to be damped. The default value is zero.
    </p>
      </div>
      <div class="refsect1">
        <a id="idp147161888"></a>
        <h2>Performance</h2>
        <p>
      A note is played on a maraca-like instrument, with the arguments as below.
    </p>
        <p>
      <span class="emphasis"><em>kamp</em></span> -- Amplitude of note.
    </p>
        <p>
      <span class="emphasis"><em>kfreq</em></span> -- Frequency of note played.
    </p>
        <p>
      <span class="emphasis"><em>kbeans</em></span> -- The number of beans in the gourd. A value of 8 seems suitable.
    </p>
        <p>
      <span class="emphasis"><em>kdamp</em></span> -- The damping value of the shaker. Values of 0.98 to 1 seems suitable, with 0.99 a reasonable default.
    </p>
        <p>
      <span class="emphasis"><em>ktimes</em></span> -- Number of times shaken.
    </p>
        <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
          <table border="0" summary="Note: Note">
            <tr>
              <td rowspan="2" align="center" valign="top" width="25">
                <img alt="[Note]" src="images/note.png" />
              </td>
              <th align="left">Note</th>
            </tr>
            <tr>
              <td align="left" valign="top">
                <p>
        The argument <span class="emphasis"><em>knum</em></span> was redundant, so it was removed in version 3.49.
      </p>
              </td>
            </tr>
          </table>
        </div>
      </div>
      <div class="refsect1">
        <a id="idp147169152"></a>
        <h2>Examples</h2>
        <p>
      Here is an example of the shaker opcode. It uses the file <a class="ulink" href="examples/shaker.csd" target="_top"><em class="citetitle">shaker.csd</em></a>.

      </p>
        <div class="example">
          <a id="idp147171008"></a>
          <p class="title">
            <strong>Example 815. Example of the shaker opcode.</strong>
          </p>
          <div class="example-contents">
            <p>See the sections <a class="link" href="UsingRealTime.html" title="Real-Time Audio"><em class="citetitle">Real-time Audio</em></a> and <a class="link" href="CommandFlags.html" title="Csound command line"><em class="citetitle">Command Line Flags</em></a> for more information on using command line flags.</p>
            <pre class="programlisting">
<span class="csdtag">&lt;CsoundSynthesizer&gt;</span>
<span class="csdtag">&lt;CsOptions&gt;</span>
<span class="comment">; Select audio/midi flags here according to platform</span>
<span class="comment">; Audio out   Audio in    No messages</span>
-odac           -iadc     -d     <span class="comment">;;;RT audio I/O</span>
<span class="comment">; For Non-realtime ouput leave only the line below:</span>
<span class="comment">; -o shaker.wav -W ;;; for file output any platform</span>
<span class="csdtag">&lt;/CsOptions&gt;</span>
<span class="csdtag">&lt;CsInstruments&gt;</span>

<span class="comment">; Initialize the global variables.</span>
<span class="ohdr">sr</span> <span class="op">=</span> 44100
<span class="ohdr">kr</span> <span class="op">=</span> 4410
<span class="ohdr">ksmps</span> <span class="op">=</span> 10
<span class="ohdr">nchnls</span> <span class="op">=</span> 1

<span class="comment">; Instrument #1</span>
<span class="oblock">instr</span> 1
kfreq	<span class="opc">line</span> p4, p3, 440
   a1 <span class="opc">shaker</span> 10000, kfreq, 8, 0.999, 100, 0
   <span class="opc">out</span> a1
<span class="oblock">endin</span>


<span class="csdtag">&lt;/CsInstruments&gt;</span>
<span class="csdtag">&lt;CsScore&gt;</span>

<span class="stamnt">i</span> 1 0 1 440
<span class="stamnt">i</span> 1 + 1 4000

<span class="stamnt">e</span>
<span class="csdtag">&lt;/CsScore&gt;</span>
<span class="csdtag">&lt;/CsoundSynthesizer&gt;</span>
</pre>
          </div>
        </div>
        <p><br class="example-break" />
    </p>
      </div>
      <div class="refsect1">
        <a id="idp147175296"></a>
        <h2>Credits</h2>
        <p>
      </p>
        <table border="0" summary="Simple list" class="simplelist">
          <tr>
            <td>Author: John ffitch (after Perry Cook)</td>
          </tr>
          <tr>
            <td>University of Bath, Codemist Ltd.</td>
          </tr>
          <tr>
            <td>Bath, UK</td>
          </tr>
        </table>
        <p>
    </p>
        <p>New in Csound version 3.47</p>
        <p>Fixed the example thanks to a message from Istvan Varga.</p>
      </div>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="sfpreset.html">Prev</a> </td>
          <td width="20%" align="center">
            <a accesskey="u" href="OpcodesTop.html">Up</a>
          </td>
          <td width="40%" align="right"> <a accesskey="n" href="shiftin.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">sfpreset </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> shiftin</td>
        </tr>
      </table>
    </div>
  </body>
</html>
